<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>
      <?php echo ($system['name']); if((CONTROLLER_NAME == 'Funding') AND (ACTION_NAME == 'detail')): ?>-<?php echo ($model['name']); endif; ?>
    </title>

    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/Public/sui/sm.min.css">
    <link rel="stylesheet" href="/Public/sui/sm-extend.min.css">
    <link rel="stylesheet" href="/Public/sui/main.css">
    <script type='text/javascript' src='/Public/sui/zepto.min.js' charset='utf-8'></script>
    <script type="text/javascript">
      $.config={
        route:false
      }
    </script>
    <script type='text/javascript' src='/Public/sui/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/Public/sui/sm-extend.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/Public/sui/jquery-3.1.1.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/Public/sui/main.js' charset='utf-8'></script>
    <!-- frozen定制表格 -->
    <!--<link rel="stylesheet" href="/Public/frozen/css/frozen.css">
    <script type='text/javascript' src='/Public/frozen/js/frozen.js' charset='utf-8'></script>-->
    <link href="/Public/jquery.dial-master/css/jquery.dial.css" rel="stylesheet" >
     <link href="/Public/hadmin/css/travelgame.css" rel="stylesheet">
    <script  src="/Public/jquery.dial-master/js/jquery.dial.js"></script>
    <link rel="stylesheet" href="/Public/font-awesome-4.7.0/css/font-awesome.min.css">
  </head>
  <body>
    <div class="page-group">
        <input type="hidden" id="post" value="<?php echo count($_POST);?>">
        <div class="page page-current">
          <header class="bar bar-nav header">
            <?php if($sui['return']): ?><a class="button button-link button-nav pull-left return">
                <span class="icon icon-left"></span>
              </a><?php endif; ?>
            <h1 class="title"><?php echo ($title); ?></h1>
            <a class="button button-link button-nav pull-right" href="<?php echo U('Home/User/index');?>">
              <span class="icon icon-me" style="margin-right:0.5em;"></span>
            </a>
          </header>
          <div class="header-replace"></div>
          <nav class="bar bar-tab">
            <a class="tab-item <?php echo ($sui['index']); ?>" href="<?php echo U('Home/Index/index');?>">
              <span class="icon icon-home"></span>
              <span class="tab-label">首页</span>
            </a>
            <a class="tab-item <?php echo ($sui['customized']); ?>" href="<?php echo U('Home/Index/customized');?>">
              <span class="icon icon-edit"></span>
              <span class="tab-label">定制</span>
            </a>
            <a class="tab-item <?php echo ($sui['funding']); ?>" href="<?php echo U('Home/Funding/list');?>">
              <span class="icon icon-friends"></span>
              <span class="tab-label">众筹</span>
            </a>
            <a class="tab-item <?php echo ($sui['game']); ?>" href="<?php echo U('Home/Travelgame/list');?>">
              <span class="icon icon-gift"></span>
              <span class="tab-label">大赛</span>
            </a>
          <?php $noticeCount = D('Notice')->where(['receive_user_id'=>session('用户')['id'], 'state'=>'未读'])->count(); if ($noticeCount != 0) { $new = true; } else { $new = false; } ?>
          <style type="text/css">
            .red-dot {
                  display:block;
                  background:#f00;
                  border-radius:50%;
                  width:5px;
                  height:5px;
                  top:-1.3rem;
                  right:1.5rem;
                  position:absolute;
            }
          </style>

            <a class="tab-item <?php echo ($sui['information']); ?>" href="<?php echo U('Home/Index/information');?>" >
              <span class="icon icon-me"></span>
              <span class="tab-label">信息<?php if($new): ?><i class="red-dot"></i><?php endif; ?></span>
            </a>
          </nav>
          <div class="content">

<link rel="stylesheet" type="text/css" href="/Public/swipe/css/swipe.css">
<div class="addWrap" style="margin-top: 0rem;">
    <div class="swipe" id="mySwipe">
        <div class="swipe-wrap">
            <?php $ad = D('Ad')->select(); ?>
            <?php if(is_array($ad)): $i = 0; $__LIST__ = $ad;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div>
                    <a href="<?php echo ($vo['href']); ?>"><img class="img-responsive" src="/Public/file/<?php echo ($vo['picture']); ?>" /></a>
                </div><?php endforeach; endif; else: echo "" ;endif; ?>
        </div>
    </div>
    <ul id="position">
        <?php if(is_array($ad)): $i = 0; $__LIST__ = $ad;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li <?php if($i == 1): ?>class="cur"<?php endif; ?> ></li><?php endforeach; endif; else: echo "" ;endif; ?>
    </ul>
</div>
<script src="/Public/swipe/js/swipe.js"></script>
<script type="text/javascript">
var bullets = document.getElementById('position').getElementsByTagName('li');
var banner = Swipe(document.getElementById('mySwipe'), {
    auto: 2000,
    continuous: true,
    disableScroll: false,
    callback: function(pos) {
        var i = bullets.length;
        while (i--) {
            bullets[i].className = ' ';
        }
        bullets[pos].className = 'cur';
    }
});
</script>
<script>
$(document).ready(function(){
	var turnplate={};
    $.post("<?php echo U('Home/Travelgame/gamebg');?>", {}, function (ret) {
            turnplate.restaraunts = ret.name;
            turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF"];
            turnplate.login = "<?php echo U('Home/User/login');?>";
            turnplate.url = "<?php echo U('Home/Travelgame/gameret');?>";
            $("#dial").dial(turnplate);
    }, 'json');
});
</script>
</br>
<div class="card">
&nbsp;
<div id="dial" style="overflow-x:hidden;width:80%">
</div>
<div class="card-content">
<div class="content-block">
</div>
&nbsp;<a href="<?php echo U('Home/Travelgame/alert', ['key' => 'prize_url']);?>" style="float:right;right:2px">领奖方法>></a>
</div>
</div>
<table class="sort-table">
		<tr>
			<td>
				<a 
					<?php if($_GET['order'] == '' OR $_GET['order'] == 'id'): ?>href="/index.php/Home/Travelgame/list/order/id desc"
					class="sort-active" 
					> 默认<i class="fa fa-sort-numeric-asc"></i>
					<?php elseif($_GET['order'] == 'id desc'): ?>
					href="/index.php/Home/Travelgame/list/order/id"
					class="sort-active" 
					> 默认<i class="fa fa-sort-numeric-desc"></i> 
					<?php else: ?>
					href="/index.php/Home/Travelgame/list/order/id"
					> 默认<i class="fa fa-sort-numeric-asc"></i><?php endif; ?>
				</a>
			</td>
              <td>
				<a 
					<?php if($_GET['order'] == 'funding_price desc'): ?>href="/index.php/Home/Travelgame/list/order/funding_price"
					class="sort-active" 
					> 价格<i class="fa fa-sort-numeric-desc"></i>
					<?php elseif($_GET['order'] == 'funding_price'): ?>
					href="/index.php/Home/Travelgame/list/order/funding_price desc"
					class="sort-active" 
					> 价格<i class="fa fa-sort-numeric-asc"></i> 
					<?php else: ?>
					href="/index.php/Home/Travelgame/list/order/funding_price"
					> 价格<i class="fa fa-sort-numeric-asc"></i><?php endif; ?>
				</a>
              </td>
              <td>
				<a 
					<?php if($_GET['order'] == 'vote'): ?>href="/index.php/Home/Travelgame/list/order/vote desc"
					class="sort-active" 
					> 投票数<i class="fa fa-sort-numeric-asc"></i>
					<?php elseif($_GET['order'] == 'vote desc'): ?>
					href="/index.php/Home/Travelgame/list/order/vote"
					class="sort-active" 
					> 投票数<i class="fa fa-sort-numeric-desc"></i> 
					<?php else: ?>
					href="/index.php/Home/Travelgame/list/order/vote"
					> 投票数<i class="fa fa-sort-numeric-asc"></i><?php endif; ?>
				</a>
			</td>

			<td align="right">
				<a href="#" class="open-panel" data-panel='#select-panel-travelgame'>筛选</a>
				<i class="fa fa-reorder"></i>
			</td>
		</tr>
	</table>
	<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="card">
	        <div class="card-header">
	            <span class="icon icon-friends"></span>
	            <?php echo ($vo['name']); ?> 
	        </div>
	        <div class="card-content">
	            <div class="card-content-inner">

	            	<div class="row">
				      <div class="col-20" style="width:30%">
	                    	<img class="list-img" src="/Public/file/<?php echo ($vo['img']); ?>" />
				      </div>
				      <div class="col-50" style="width:60%">
				      		<?php $fundingType = D('FundingType')->find($vo['funding_type']); $fundingModel = D('Funding'.ucfirst($fundingType['en'])); $fundingSpecify = $fundingModel->where(['principal_id'=>$vo['id']])->find(); ?>
				      		众筹价格：￥<?php echo ($vo['funding_price']); ?> <br/>
				      		<?php if($fundingType['en'] == 'eat'): ?>餐饮类型：<?php echo ($fundingSpecify['eat_type']); ?><br/>
				      			用餐时间：<?php echo (date("Y-m-d H", $fundingSpecify['eat_time'])); ?>时<br/>
				      			用餐地点：<?php echo ($fundingSpecify['eat_location']); ?><br/>
				      		<?php elseif($fundingType['en'] == 'hotel'): ?>
				      			酒店类型：<?php echo ($fundingSpecify['hotel_type']); ?><br/>
				      			入住时间：<?php echo (date("Y-m-d", $fundingSpecify['start_time'])); ?><br/>
				      			离店时间：<?php echo (date("Y-m-d", $fundingSpecify['end_time'])); ?><br/>
				      			酒店地点：<?php echo ($fundingSpecify['hotel_location']); ?><br/>
				      		<?php elseif($fundingType['en'] == 'traffic'): ?>
				      			交通方式：<?php echo ($fundingSpecify['traffic_type']); ?><br/>
				      			出发地：<?php echo ($fundingSpecify['departure']); ?><br/>
				      			目的地：<?php echo ($fundingSpecify['destination']); ?><br/>
				      			出发时间：<?php echo (date("Y-m-d H:i:s", $fundingSpecify['start_time'])); ?><br/>
				      		<?php elseif($fundingType['en'] == 'travel'): ?>
				      			旅游类型：<?php echo ($fundingSpecify['travel_type']); ?><br/>
				      			出发地：<?php echo ($fundingSpecify['departure']); ?><br/>
				      			目的地：<?php echo ($fundingSpecify['destination']); ?><br/>
				      			天数：<?php echo ($fundingSpecify['days']); ?><br/>
							<?php elseif($fundingType['en'] == 'specialty'): ?>
				      			旅游类型：<?php echo ($fundingSpecify['specialty_type']); ?><br/>
				      			源产地：<?php echo ($fundingSpecify['origin']); ?><br/>
				      			发货时间：<?php echo ($fundingSpecify['delivery_time']); ?><br/>
							<?php elseif($fundingType['en'] == 'play'): ?>
								娱乐类型：<?php echo ($fundingSpecify['play_type']); ?><br/>
				      			地点：<?php echo ($fundingSpecify['play_location']); ?><br/>
				      			时间：<?php echo (date("Y-m-d H:i:s", $fundingSpecify['play_time'])); ?><br/><?php endif; ?>
				      		已筹<?php echo ($vo['already_num']); ?>人/还剩<?php echo ($vo['total_num'] - $vo['already_num']); ?>人 <br/>
				      </div>
				    </div>
	                <div class="list-desc">
	                    <?php echo ($vo['special']); ?>
	                </div>
	            </div>
	        </div>
	        <div class="card-footer">
              <a id="vote_<?php echo ($vo['id']); ?>" class="button" onclick="javascript:vote(<?php echo ($vo['id']); ?>)" <?php if($vo['vote'] == 0): ?>style="color:#686a6b;border-color:#686a6b"<?php endif; ?>>
              <span class="icon icon-emoji">
                <label id="vote_num_<?php echo ($vo[id]); ?>"><?php if($vo['vote_num'] == 0): ?>投票<?php else: echo ($vo['vote_num']); endif; ?></label></span></a>

            <a id="like_<?php echo ($vo['id']); ?>" class="button" onclick="like(<?php echo ($vo['id']); ?>)" <?php if($vo['like'] == 0): ?>style="color:#686a6b;border-color:#686a6b"<?php endif; ?>>
              <span class="icon icon-star">
                <label id="like_num_<?php echo ($vo['id']); ?>"><?php if($vo['like_num'] == 0): ?>赞<?php else: echo ($vo['like_num']); endif; ?></label></span></a>

            <a href="<?php echo U('Travelgame/detail', ['id'=>$vo['id'], 'discuss'=>1]);?>" class="button" <?php if($vo['comment'] == 0): ?>style="color:#686a6b;border-color:#686a6b"<?php endif; ?>>
              <span class="icon icon-message">
              <label id="discuss_num"><?php if($vo['comment_num'] == 0): ?>评论<?php else: echo ($vo['comment_num']); endif; ?></label></span></a>

	          <a href="<?php echo U('Travelgame/detail', ['id'=>$vo['id']]);?>" class="button"><span class="icon icon-search"></span> 查看详情</a>
	        </div>
	    </div><?php endforeach; endif; else: echo "" ;endif; ?>
<?php echo ($page); ?>
</div>
</div>
</div>
<div class="panel-overlay"></div>
<div class="panel panel-left panel-reveal theme-dark" id='select-panel-guider'>
    <div class="content-block">
        <p>根据条件筛选</p>
    </div>
    <form>
        <div class="list-block">
            <ul>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="searchMap[location]" placeholder="服务地区" value="<?php echo ($_GET['searchMap']['location']); ?>">
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <select name="searchMap[age]">
                                    <option value="">年龄不限</option>
                                    <option value="0,20" <?php if($_GET['searchMap']['age'] == '0,20'): ?>selected<?php endif; ?>>20岁以下</option>
                                    <option value="21,30" <?php if($_GET['searchMap']['age'] == '21,30'): ?>selected<?php endif; ?>>21~30岁</option>
                                    <option value="31,40" <?php if($_GET['searchMap']['age'] == '31,40'): ?>selected<?php endif; ?>>31~40岁</option>
                                    <option value="41,50" <?php if($_GET['searchMap']['age'] == '41,50'): ?>selected<?php endif; ?>>41~50岁</option>
                                    <option value="51,100" <?php if($_GET['searchMap']['age'] == '51,100'): ?>selected<?php endif; ?>>51岁以上</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <select name="searchMap[gender]">
                                    <option value="">性别不限</option>
                                    <option value="男" <?php if($_GET['searchMap']['gender'] == '男'): ?>selected<?php endif; ?>>男</option>
                                    <option value="女" <?php if($_GET['searchMap']['gender'] == '女'): ?>selected<?php endif; ?>>女</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <select name="searchMap[degree]">
                                    <option value="">导游学历</option>
                                    <option value="专科" <?php if($_GET['searchMap']['degree'] == '专科'): ?>selected<?php endif; ?>>专科</option>
                                    <option value="本科" <?php if($_GET['searchMap']['degree'] == '本科'): ?>selected<?php endif; ?>>本科</option>
                                    <option value="硕士" <?php if($_GET['searchMap']['degree'] == '硕士'): ?>selected<?php endif; ?>>硕士</option>
                                    <option value="博士" <?php if($_GET['searchMap']['degree'] == '博士'): ?>selected<?php endif; ?>>博士</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="searchMap[special]" placeholder="导游专长" value="<?php echo ($_GET['searchMap']['special']); ?>">
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="searchMap[nationality]" placeholder="导游国籍" value="<?php echo ($_GET['searchMap']['nationality']); ?>">
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="content-block">
            <div class="row">
                <div class="col-50"><a href="#" class="button button-big button-fill button-danger close-panel">取消</a></div>
                <div class="col-50">
                    <input type="submit" class="button button-big button-fill button-success" />
                </div>
            </div>
        </div>
    </form>
</div>
<div class="panel panel-left panel-reveal theme-dark" id='select-panel-funding'>
    <div class="content-block">
        <p>根据条件筛选</p>
    </div>
    <form>
        <div class="list-block">
            <ul>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="searchMap[name]" placeholder="关键字" value="<?php echo ($_GET['searchMap']['name']); ?>">
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <select name="searchMap[funding_type]">
                                    <option value="">众筹类型</option>
                                    <?php $fundingTypeList = D('FundingType')->select(); ?>
                                    <?php if(is_array($fundingTypeList)): $i = 0; $__LIST__ = $fundingTypeList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo['id']); ?>" <?php if($_GET['searchMap']['funding_type'] == $vo['id']): ?>selected<?php endif; ?>><?php echo ($vo['long_name']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="content-block">
            <div class="row">
                <div class="col-50"><a href="#" class="button button-big button-fill button-danger close-panel">取消</a></div>
                <div class="col-50">
                    <input type="submit" class="button button-big button-fill button-success" />
                </div>
            </div>
        </div>
    </form>
</div>

<div class="panel panel-left panel-reveal theme-dark" id='select-panel-travelgame'>
    <div class="content-block">
        <p>根据条件筛选</p>
    </div>
    <form>
        <div class="list-block">
            <ul>
                <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="keyword" placeholder="关键字" value="<?php echo ($_GET['keyword']); ?>">
                            </div>
                        </div>
                    </div>
                    </li>
                    <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="departure" placeholder="始发地" value="<?php echo ($_GET['departure']); ?>">
                            </div>
                        </div>
                    </div>
                    </li>
                    <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="destination" placeholder="目的地" value="<?php echo ($_GET['destination']); ?>">
                            </div>
                        </div>
                    </div>
                    </li>
                    <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="days" placeholder="天数" value="<?php echo ($_GET['days']); ?>">
                            </div>
                        </div>
                    </div>
                    </li>
                    <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="startprice" placeholder="价格范围(起始)" value="<?php echo ($_GET['startprice']); ?>">
                            </div>
                        </div>
                    </div>
                </li> <li>
                    <div class="item-content">
                        <div class="item-inner">
                            <div class="item-input">
                                <input type="text" name="endprice" placeholder="价格范围(结束)" value="<?php echo ($_GET['endprice']); ?>">
                            </div>
                        </div>
                    </div>
                </li>
              </ul>
        </div>
        <div class="content-block">
            <div class="row">
                <div class="col-50"><a href="#" class="button button-big button-fill button-danger close-panel">取消</a></div>
                <div class="col-50">
                    <input type="submit" class="button button-big button-fill button-success" />
                </div>
            </div>
        </div>
    </form>
</div>
</body>

</html>

<script>
function vote(id) {
    var mode = "<?php echo ($mode); ?>";
    console.log(mode);
    if (mode == 'vote') {
    $.post('<?php echo U(vote);?>', {fid: id}, function (ret) {
        if (ret.status == 0) {
            if (ret.flag == 1) {
                $("#vote_"+id).attr('style', '');
            } else {
                $("#vote_"+id).attr('style', 'color:#686a6b;border-color:#686a6b');
            }
            $("#vote_num_"+id).html(ret.num);
        } else if (ret.status == 2) {
            alert(ret.msg);
            location.href = "<?php echo U('Home/User/login');?>";
        } else {
            alert(ret.msg);
        }
    }, 'json');
    } else {
        location.href = "<?php echo U('Home/Travelgame/alert', ['key' => 'votedetail']);?>";
    }
}

function like(id) {
    $.post('<?php echo U(like);?>', {fid: id}, function (ret) {
        if (ret.status == 0) {
            if (ret.flag == 1) {
                $("#like_"+id).attr('style', '');
            } else {
                $("#like_"+id).attr('style', 'color:#686a6b;border-color:#686a6b');
            }
            $("#like_num_"+id).html(ret.num);
        } else if (ret.status == 2) {
            alert(ret.msg);
            location.href = "<?php echo U('Home/User/login');?>";
        } else {
            alert(ret.msg);
        }
    }, 'json');
}
$("#alertdetail").on('click','.alert-text',function () {
                $.alert('<?php echo ($alertdetail); ?>');
});
$("#prize_url").on('click','.alert-text',function () {
                $.alert('<?php echo ($prize_url); ?>');
});

</script>